package com.itheima.controller;

import com.itheima.pojo.Goods;
import com.itheima.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(path = "/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    /**
     * 根据ID查询商品信息
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Goods findById(@PathVariable("id") String id) {

        return goodsService.findById(id);
    }

}
